<template>
    <div>
        <Spin fix size="large" v-if="decisionHandInvokeLoading"/>
        <Card style="width:100%" shadow>
            <Row type="flex" justify="center" align="middle" >
                <Col style="width: 80%;">
                    <span style="margin-top:-10px;margin-left:50px;text-align: left;font-weight:600">申请编号：{{this.applyNo}}</span>
                    &nbsp&nbsp&nbsp<Tag v-for="item in this.labelList" :color="item.labelColor" >{{item.labelName}}</Tag>
                </Col>
                <Col style="width: 18%;text-align:right;" v-if="isCheck">
                    <span style="font-weight: bolder;font-size: 14px;">{{decisionInvokeNewestDateStr}}</span>
                    <Button type="primary" @click="decisionHandInvoke" ghost >重新调用决策引擎</Button>
                </Col>
            </Row>
            <br/>
            <Row >
                <Col>
                    <Row>
                        <iframe :src="url" frameborder="0" width="100%" :style="{height:calHeight}" scrolling="auto"></iframe>
                    </Row>
                </Col>
            </Row>
        </Card>
    </div>
</template>

<script>
    import LeaseIframe from '_c/iframe/iframe'
    import {decisionHandInvoke, newestDecisionHandInvokeDateStr} from "../../../../../api/afs-case/tortoise/tortoise";
    import {queryApproveTaskSummary} from "../../../../../api/afs-case/approve/regularApproveDetail";
    export default {
        name: "pre-loan-identify",
        components: {
            LeaseIframe
        },
        props: {
            taskId: {
                required: false,
                default:()=>{
                    return '';
                }
            },
            applyNo: {
                required: false,
                default:()=>{
                    return '';
                }
            },
            isCheck:{
                type:Boolean
            },
            url:{
                type:String
            }
        },
        data:function () {
            return {
                taskSerNo:'',
                pageInfo:{},
                labelList:[],
                decisionHandInvokeLoading:false,
                decisionInvokeNewestDateStr:""
            }
        },
        methods:{
            initInfo(){
                let params = {
                    applyNo: this.applyNo
                }
                queryApproveTaskSummary(params).then(res => {
                    if (res.code === "0000") {
                        this.pageInfo = res.data;
                        this.labelList=res.data.labelList;
                    }
                });
                newestDecisionHandInvokeDateStr(params).then(res=>{
                    this.decisionInvokeNewestDateStr = res.data;
                })
            },
            init() {
                this.initInfo();
            },
            decisionHandInvoke(){
                this.$Modal.confirm({
                    title:"决策引擎重新调用",
                    content:"确认重新调用决策引擎?",
                    onOk:()=>{
                        let params = {
                            applyNo: this.applyNo
                        };
                        this.decisionHandInvokeLoading = true;
                        decisionHandInvoke(params).then(res=>{
                            this.$Message.info("操作成功!");
                            this.initInfo();
                        }).finally(()=>{
                            this.decisionHandInvokeLoading = false;
                        })
                    }
                })

            }
        },
        mounted() {
            this.init();
        },
        computed:{
            calHeight(){
                return (window.innerHeight)-65 + 'px';
            }
        },
        created() {
            this.taskSerNo = this.taskId!=''?this.taskId:this.afs.getPageParams(this).taskId;
            this.applyNo = this.applyNo!=''?this.applyNo:this.afs.getPageParams(this).applyNo;
        }
    }
</script>

<style scoped>

</style>
